﻿using System.Collections.Generic;
using Terraria;
using Terraria.ModLoader;

namespace HardcoreGame.Common.GlobalItems
{
    public class ResearchTooltipAdjustment : GlobalItem
    {
        public override void ModifyTooltips(Item item, List<TooltipLine> tooltips)
        {
            if (Main.GameModeInfo.IsJourneyMode)
            {
                TooltipLine researchLine = null;
                int originalIndex = -1;
                for (int i = 0; i < tooltips.Count; i++)
                {
                    if (tooltips[i].Mod == "Terraria" && tooltips[i].Name == "JourneyResearch")
                    {
                        researchLine = tooltips[i];
                        originalIndex = i;
                        break;
                    }
                }
                if (researchLine != null)
                {
                    tooltips.RemoveAt(originalIndex);
                    tooltips.Add(researchLine);
                }
            }
        }
    }
}
